/*
Copyright (C) Huawei Technologies Co., Ltd. 2015. All rights reserved.
See LICENSE.txt for this sample's licensing information.
 */

package com.yvan.onekeylock;

/**
 * Provides the list of dummy commands.
 */
public class CommandItem {

    public static final String COMMAND = "command";
    public static final int REBOOT_CODE = 0x100;
    public static final int SHUTDOWN_CODE = 0x101;
    /**
     * The list of dummy commands.
     */
    public static final CommandItem[] COMMAND_ITEMs = {
            new CommandItem("重启", R.drawable.reboot, REBOOT_CODE),
            new CommandItem("关机", R.drawable.shutdown, SHUTDOWN_CODE),
    };

    /**
     * The name of this command.
     */
    private final String mName;

    /**
     * 执行命令代号
     */
    private final int mCommandCode;

    private final int mIcon;

    /**
     * Instantiates a new {@link CommandItem}.
     *
     * @param name The name of the command.
     */
    public CommandItem(String name, int icon, int commandCode) {
        mName = name;
        mIcon = icon;
        mCommandCode = commandCode;
    }

    /**
     * Finds a {@link CommandItem} specified by a command ID.
     *
     * @param id The command ID. This needs to be a valid ID.
     * @return A {@link CommandItem}
     */
    public static CommandItem byId(int id) {
        return COMMAND_ITEMs[id];
    }


    public String getName() {
        return mName;
    }

    public int getIcon() {
        return mIcon;
    }

    public int getCommandCode() {
        return mCommandCode;
    }
}
